
//class
var Class = function(params){
  //private scope magic
  var that = {};
  
  //variables
  var name;
  var view;
  
  //constractor
  name = params.name || 'anonymous';
  view = params.view || document.getElementById('view');
  
  //public methods
  that.getName = function(){
    return name;
  }
  that.setName = function(n){
    name = n;
  }
  that.getView = function(){
    return view;
  }
  that.appendShowText = function(str){
    view.innerHTML += upperCase(str) + "<br/>";
  }
  
  //private methods
  var upperCase = function(str){
    return str.toUpperCase();
  }
  
  return that;
}

//main
document.addEventListener("DOMContentLoaded", function(){
  var c = Class({
    name: '',
  });
  
  c.appendShowText(c.getName());
  c.setName('hoge');
  c.appendShowText(c.getName());
  
}, false);


